module.exports = app =>{
    const { INTEGER,DATE,STRING } = app.Sequelize;
    const PostImage = app.model.define('post_image', {
        postId: {
          type: INTEGER(20),
          primaryKey: true,
          allowNull: false,
          defaultValue: 0,
          comment: '图片ID',
        },
        imgUrl: {
          type: STRING(255),
          primaryKey: true,
          allowNull: false,
          defaultValue: '',
          comment: "图片url",
        },
        created_time: {
            type:DATE
        },
        updated_time:{
            type:DATE
        }
    });
    // 关联关系
    PostImage.associate = function (models) {
        // 关联帖子
        PostImage.belongsTo(app.model.Post);
    }
    return PostImage;
}